home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir42
/
aaco25.zip
/
AACOLOR.DOC
< prev
next >
Wrap
Text File
|
1993-07-03
|
43KB
|
945 lines
╔═════════════════╗
║ a a C o l o r ║
╚═════════════════╝
...Alan Anderson's Color Set Editor for Foxpro 2.5
U S E R ' S M A N U A L
=========================
3nd Edition - March, 1993
Copyright (c) 1991-1993 Chamber Data Systems, Inc.
All Rights Reserved.
FoxPro is a registered trademark of Microsoft Corporation
Chamber Data Systems, Inc.
15221 Berry Trail, Suite 510
Dallas, Texas 75248
Voice: (214) 233-1299
FAX: (214) 233-8508
CompuServe ID: 76566,2666
TABLE OF CONTENTS
-----------------
The FoxPro Color Set System 1
Introduction 1
Screen Objects 1
Color Pair Codes 3
Color Sets 4
Color Schemes 6
Putting It All Together 8
A Few Complications 9
Coding Examples 11
Using aaColor 13
Installation 13
Selection Techniques 13
Appendix: Mouse Pointer Color 14
THE FOXPRO COLOR SET SYSTEM
===========================
INTRODUCTION
------------
FoxPro has an extremely powerful and flexible system for
controlling the color of screen objects which is based on a
concept called color sets. However, FoxPro's implementation of
color sets seems incomplete; the facilities for managing and
editing color sets are meager and, in many respects, confusing.
Fortunately, the foundation of the concept of color sets is
solid, and FoxPro provides the tools to develop better attendant
facilities. aaColor is such a facility--a simple yet robust tool
for understanding, managing, and editing color sets.
SCREEN OBJECTS
--------------
An awareness of the various screen objects supported in FoxPro
and their colorable elements is key to understanding FoxPro's
system of controlling colors. FoxPro supports the following
types of screen objects.
Menu System
Windows:
System
Dialogs
Alerts
User
Browse
Report Layout
A screen object is built from or contains lower level elements.
For example, the elements of a Menu System are the selection pads
on its menu bar and each pad's associated popup consisting of
selection bars inside a border. The elements of a Dialog Window
are its title, border, text, fields, popups, lists, push buttons,
check boxes, etc. Some window elements are input/output items
created with "@... GET" commands such as fields and check boxes;
other elements are items inherent to the window definition such
as the window title, border, and shadow.
FoxPro's system for controlling colors allows you to
independently specify the color of the various elements that
comprise a screen object. The discussions that follow refer to
them as a screen object's "colorable elements."
- Page 1 -
Considering the several screen objects that FoxPro supports and
the numerous colorable elements that can make up each type of
screen object, FoxPro's system for controlling colors calls for
flexibility. Indeed, it is flexible, and its flexibility makes
it somewhat complicated. But once understood, and with the help
of aaColor, it is fairly simple to use.
A side issue here is that of windows. Observe in the preceding
list of screen objects that windows are subdivided into four
classes: system windows, dialog windows, alert windows, and user
windows. These various classes of windows are the same so far as
the FoxPro facilities that you use to create and control them.
(Except for system windows that are automatically created for
you, you use the DEFINE WINDOW command to create windows and
"@...SAY/GET" commands to create objects within them.) Windows
in the various classes differ only in their intended use as their
names imply and as summarized below.
SYSTEM WINDOWS: The FoxPro development environment uses system
windows for nearly everything except dialogs and alerts. It uses
system windows for file editing, on-line help, and all of the
desk accessories (calculator, calendar, etc.). System windows
are distinguished by their color and the fact that their borders
are blank except for window control icons (the icons for closing,
zooming, sizing, etc.). An application program would use system
windows for any similar functions implemented in the application
such as on-line help and desk accessories.
DIALOGS: A dialog is a window used to allow a user to specify
further information after initiating a program action in order to
further direct the program action. Dialog windows typically
contain an assortment of elements such as lists, popups, check
boxes, radio buttons, and other controls and fields pertinent to
their function as dialogs.
ALERTS: Alerts are windows that inform a user of some error,
condition, or important choice to be made. An alert usually
requires a response or an acknowledgement from the user before
processing can proceed. Alert windows typically contain only
text and the one or more push buttons required for a user to
respond to the alert; they do not contain elements extraneous to
their function such as popups, lists, check boxes, or radio
buttons.
USER WINDOWS: The FoxPro documentation makes no mention of the
intended use of user windows, and although the FoxPro development
environment uses dialogs and alerts, it does not employ windows
of this class. A major use of windows not included in any of the
other classes of windows is that of database input/output
screens, so that could be the assigned use of user windows in an
application program.
- Page 2 -
Although the facilities for creating and controlling these
various classes of windows are the same (a window is a window
except for how you program it to be used), each class of windows
is characterized by its intended use which influences the types
of elements that comprise windows of that class. Additionally,
FoxPro uses unique colors--and in some cases, unique border
styles--for each class of windows in its development environment
to provide a visual cue as to a window's class--alert, dialog,
etc. FoxPro's system for controlling colors allows you to do the
same in applications that you develop.
COLOR PAIR CODES
----------------
Color monitors display colors by combining the colors red, green,
and blue in various combinations. These three colors can be
combined in eight possible ways to form eight basic colors which
you specify in FoxPro with codes as follows:
Color Code
─────── ────
Black N (no color)
Blue B
Green G
Cyan BG (Blue & Green combined)
Red R
Magenta RB (Red & Blue combined)
Brown GR (Green & Red combined)
White W (Blue, Green, & Red combined)
You specify the foreground and background colors for the
characters of a colorable screen element--for example, an
"@... SAY" field--with a color pair, that is, a pair of color
codes separated by a slash (/). For example, W/B specifies a
white foreground on a blue background. The eight colors can be
combined two at a time to form 64 different color pairs.
Including a plus sign (+) after the foreground color in a color
pair denotes that the foreground color is brightened. For
example, W+/B specifies a bright white foreground on a blue
background. This feature doubles the number of available color
pairs to 128 by doubling the number of available foreground
colors.
Note: The color brown (code GR) when brightened (code GR+)
appears as yellow and so is called yellow rather than
bright brown.
Including an asterisk (*) in a color pair denotes a blinking
foreground if SET BLINK is ON or a bright background if SET BLINK
is OFF. For example, if SET BLINK is ON, then W/B* specifies a
- Page 3 -
blinking white foreground on a blue background; if SET BLINK is
OFF, then W/B* specifies a white foreground on a bright blue
background. (It doesn't make any difference where you place the
asterisk; W/B* yields the same result as W*/B.) Thus, if SET
BLINK is OFF, this feature doubles the number of available color
pairs to 256 by doubling the number of available background
colors.
(The color picker in aaColor provides a good way to view all
possible color pairs and allows you to experiment with different
combinations of BLINK set to ON or OFF with or without an
asterisk.)
COLOR SETS
----------
As previously mentioned, FoxPro supports several types of screen
objects, many of which have numerous colorable elements. The
problem of being able to independently control the colors of all
the various types of screen objects at the level of their
respective colorable elements obviously calls for a solution
involving many color pairs.
FoxPro's solution is the use of "color sets." A color set is
simply a two-dimensional array of color pairs such that various
positions in the array are assigned to particular colorable
elements in the various types of screen objects. For example,
the color pair at column 1, row 1 of a color set specifies the
color of an "@... SAY" field in a User Window; the color pair at
column 3, row 7 of a color set specifies the color of popup
option hot keys in the System Menu; and so on. Hence, the color
pairs in a color set determine, in a manner predefined by the
position of each, the colors of each colorable element in each
type of screen object supported by FoxPro. The FoxPro
Developer's Guide has a table that shows color pair assignments
for color sets.
Note: A color set is not a memory variable array such as
one defined with the DIMENSION command in an
application program but rather an array within FoxPro,
and the color pairs in a color set are stored as
binary values rather than as color pair codes.
However, you specify color pairs with color pair codes
in any FoxPro functions or commands that require
specification of color pairs.
The array that comprises a color set has 24 columns and 11 rows
for a total of 264 positions. The 24 positions in the eleventh
row of a color set have a special purpose related to window
shadows which is described in the discussion of color schemes in
the next section. Each of the other 240 positions in a color set
contain a color pair.
- Page 4 -
Color Set:
1 2 3 4 5 6 . . . 23 24
┌────┬────┬────┬────┬────┬────┬─ ─┬────┬────┐
1 │ cp │ cp │ cp │ cp │ cp │ cp │ . . . │ cp │ cp │
├────┼────┼────┼────┼────┼────┼─ ─┼────┼────┤
2 │ cp │ cp │ cp │ cp │ cp │ cp │ . . . │ cp │ cp │
├────┼────┼────┼────┼────┼────┼─ ─┼────┼────┤
3 │ cp │ cp │ cp │ cp │ cp │ cp │ . . . │ cp │ cp │
├────┼────┼────┼────┼────┼────┼─ ─┼────┼────┤
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
├────┼────┼────┼────┼────┼────┼─ ─┼────┼────┤
10 │ cp │ cp │ cp │ cp │ cp │ cp │ . . . │ cp │ cp │
├────┼────┼────┼────┼────┼────┼─ ─┼────┼────┤
11 │ si │ si │ si │ si │ si │ si │ . . . │ si │ si │
└────┴────┴────┴────┴────┴────┴─ ─┴────┴────┘
Legend: cp = color pair
si = shadow indicator
Most of the positions in the first half of a color set
array--those in columns 1 through 12--are assigned to colorable
elements of screen objects. The FoxPro Developer's Guide refers
to columns 13 through 16 as "reserved for future use" (presumably
for new types of screen objects that may be introduced in a
future version of FoxPro). It refers to columns 17 through 24 as
"user schemes" which presumably means that they are available to
a developer to define as desired--possibly to assign colors to
additional classes of windows or other screen objects that a
developer may invent in addition to those already defined in
FoxPro.
In any case, a color set contains many color pairs. And,
considering that each color pair can have any of 256 different
values, the number of ways that a color set can be created to
specify colors for the various screen objects and their colorable
elements is practically without limit. Thus, FoxPro's color set
system allows an enormous amount of variety in specifying color.
Color sets are stored in a resource file and assigned unique
names so that they can be individually referenced by facilities
that load and store color sets from or to a resource file. The
default resource file shipped with FoxPro, FOXUSER.DBF/FPT,
includes several color sets.
- Page 5 -
FoxPro provides two commands and one interactive facility for
managing and editing color sets. The two commands are
SET COLOR SET TO <color set name>
and
CREATE COLOR SET <color set name>.
SET COLOR SET TO <color set name> loads and activates a specified
color set from the resource file. By maintaining different color
sets in a resource file, you can instantly change the entire
coloring of the FoxPro development environment or a FoxPro
application program by simply activating a different color set.
CREATE COLOR SET <color set name> stores the currently active
color set to the resource file and names it as specified. If a
color set already exists in the resource file with the same name,
it is overwritten.
You can also load and store color sets from and to a resource
file with FoxPro's color picker, an interactive facility accessed
from the System Menu (see Window pad, popup option Color...).
The color picker is FoxPro's only interactive facility for
editing a color set, that is, for modifying the values of color
pairs in a color set. As such, FoxPro's color picker is an
important component in its color set system. Yet curiously, it
is the component that is most lacking in function and clarity.
Its deficiencies are the cause of much criticism of the entire
color set system and the reason that aaColor was developed.
COLOR SCHEMES
-------------
The previous section describes a color set as an array of color
pairs where each position in the array specifies the color of
some particular colorable screen element in a predefined way.
The FoxPro documentation describes a color set as a collection of
"color schemes" and defines a color scheme as a list of ten color
pairs.
You can see by inspecting the table of color pair assignments for
color sets in the FoxPro Developer's Guide that a color scheme is
simply a column in the array of color pairs comprising a color
set. This table also shows that the assignments are such that a
color scheme--a column in the color set array--corresponds to the
various colorable elements of a screen object of some kind--for
example, a menu or a dialog window.
The table of color pair assignments shows only ten rows.
However, a color set array has an additional eleventh row not
shown in the table that, as previously mentioned, has a special
- Page 6 -
purpose related to shadows. The eleventh row of a color
set--that is, the eleventh position of each of its color
schemes--contains a plus or minus sign (+ or -) to indicate
whether or not the screen object to which a color scheme
corresponds casts a shadow. So a color scheme is actually a list
of ten color pairs followed by a plus or minus sign (+ or -).
Example: Color Scheme 1 - User Windows
Position Code Element Colored
──────── ─────── ───────────────────────────────────
1 W+/B Normal Text
2 W+/BG Field, Enabled
3 GR+/B Border
4 GR+/B Title, Active
5 W/B Title, Idle / System Message Line
6 W+/RB Text/Control, Selected
7 GR+/B Push Button Hot Keys / System Clock
8 N+/N Shadow
9 W+/B Control, Enabled
10 W/B Field/Control, Disabled
11 + Casts Shadow
This example lists the color pairs vertically to be consistent
with the fact that a color scheme is a column in a color set
array. However, the FoxPro documentation list them horizontally
and separated by commas.
Example: W+/B,W+/BG,GR+/B,GR+/B,W/B,W+/RB,GR+/B,N+/N,W+/B,W/B,+
The horizontal, comma-delimited format is the required syntax for
specifying a color pair list in commands that allow one to be
specified.
A color scheme is identified by its column number in the color
set array (1, 2, 3, ..., 24). The FoxPro documentation also
includes descriptive names of color schemes such as Menu Bar,
Menu Pops, Dialogs, Dialog Pops, etc. However, any references to
a color scheme in a FoxPro command or function is by its number;
descriptive names appear only in the FoxPro documentation and
certain popups in dialogs for selecting color schemes.
Commands that create a screen object such as DEFINE WINDOW and
DEFINE MENU support the clause
COLOR SCHEME <scheme number>
so that a specified color scheme can be associated with the
screen object being created. With certain exceptions discussed
later, a screen object so defined requires no further color
specifications for its colorable elements; the specified color
scheme controls the color of all the object's colorable elements.
For example, if you include the clause COLOR SCHEME <scheme
- Page 7 -
number> in a DEFINE WINDOW command, the specified color scheme
controls all of the window's colorable elements--its border,
title, etc., and also elements subsequently created with
"@... SAY/GET" commands.
Note: The clause COLOR SCHEME <scheme number> can also be
specified in "@... SAY/GET" commands. However, control
at that level is only necessary if you want "@... SAY/GET"
items to have colors different than those specified by
the window's controlling color scheme.
In addition to the clause COLOR SCHEME <scheme number> that is
available in the numerous commands that create various types of
screen objects, FoxPro provides the following command and
function that deal directly with color schemes.
SET COLOR OF SCHEME <scheme number> TO <color pair list>|
<scheme number>
SCHEME(<scheme number>[, <pair number>])
The command SET COLOR OF SCHEME... sets the color pairs and
shadow indicator of the specified scheme to the specified values.
aaColor utilizes this command in the editing of color sets.
However, it seems unlikely that an application program other than
a color set editor like aaColor would have a need to use this
command if the application program makes proper use of color
sets.
The function SCHEME(...) returns the color pair list and shadow
indicator (or optionally, only the specified color pair) from the
specified color scheme.
PUTTING IT ALL TOGETHER
-----------------------
The system of controlling color in FoxPro consists of
1) maintaining color sets, each of which is a collection of color
schemes, each of which is a list of color pairs that control the
colors of colorable elements of the type of screen object to
which the color scheme is assigned;
2) loading the desired color set from the resource file (if using
a color set other than the default color set); and
3) using the clause COLOR SCHEME <scheme number> in commands that
create screen objects in order to link each screen object to its
appropriate color scheme, that is, the column of color pairs in
the color set that controls the colors of the screen object's
colorable elements.
- Page 8 -
Although FoxPro's color set system may seem complicated, it is
extremely flexible and has the advantage of centralized and
automated control. It's flexible in that you can create and
maintain many different color sets in the resource file. It's
centralized in that the specification of all current color
settings are stored in a single repository--the currently active
color set. And it's automatic in that the colors of all the
various colorable elements of screen objects that you create are
automatically determined by linking the object to the currently
active color set using the clause COLOR SCHEME <scheme number> in
the commands that create the objects. Furthermore, you can
instantly change the entire coloring of the FoxPro development
environment or a FoxPro application program by simply activating
a different color set from the resource file.
Compare this to FoxBASE+, FoxPro's predecessor. Control of color
in FoxBASE+ was limited to the command
SET COLOR TO [<standard>[, <enhanced>[, <border>]]]
which you had to invoke each time you wanted to change colors and
which, if you wanted to achieve any variety in the use of colors,
had to be sprinkled throughout a program. FoxPro's color set
system is a giant step forward.
A FEW COMPLICATIONS
-------------------
This section describes an aspect of FoxPro's color set system
that somewhat clutters its otherwise elegant solution for
controlling color and explains how aaColor solves this problem.
The complication (as described below) is that 1) in some cases
two color schemes jointly control the colors of a single screen
object, and 2) in some cases a single color pair jointly controls
the color of more than one type of element in a screen object.
(An example of the latter is that the same color pair controls
the color of the system clock and a push button hot key in a User
Window.)
The prior description of color schemes was oversimplified for the
sake of explanation when it stated that color schemes--that is,
columns in a color set array--are assigned to control the colors
of the various types of screen objects. Actually, some screen
objects require two color schemes to control their colors.
Consider the various classes of windows (dialogs, alerts, etc.).
Let's call the elements in a window that are created with
"@... SAY/GET" commands subobjects of the window--fields, push
buttons, radio buttons, check boxes, popups, lists, etc. The
number of colorable elements that can comprise a window and all
of its possible subobjects is sixteen, six more than the ten
color pairs in a color scheme. Therefore, a single color scheme
- Page 9 -
is not sufficient for controlling the sixteen colorable elements
of a window. Two types of window subobjects--namely, popups and
lists--account for the number of colorable elements in excess of
ten.
Popups and lists are considered subobjects of a window when they
are created in the window, but you could consider them to be
screen objects in their own right if not created in a window but
rather created in the screen. (Recent trends in the design of
window-oriented user interfaces suggest that you should create
popups and lists in windows and therefore consider them to be
subobjects of windows.) In any case, popups and lists have six
colorable elements each and are similar in structure. So popups
and lists are jointly assigned their own color schemes to control
their colors.
Thus, a window requires two color schemes to control its
colors--the primary color scheme that controls the colors of
colorable elements except for popups and lists, and an additional
color scheme that controls the colors of popups and/or lists to
which it is host.
The following table shows the color schemes used to control the
various classes of windows and their respective popups and lists.
Window Classes Color Schemes (Primary & Popup/List)
────────────── ─────────────────────────────────────
System Windows 8 & 9
Dialogs 5 & 6
Alerts 7 & 12
User Windows 1 & 2
Note: The FoxPro documentation describes COLOR SCHEME 2 as
controlling the color of "User Menus." This appears
to be a misnomer in that 1) it implies that there is a
screen object called a User Menu that requires its own
color scheme when in fact there does not seem to be
such a screen object or the requirement for one; and
2) COLOR SCHEME 2, in fact, controls the colors of
popups and lists in user windows. Since the color
schemes that control the colors of popups and lists in
system windows, dialogs, and alerts are called "System
Window Pops", "Dialog Pops", and "Alert Pops",
respectively, then Color Scheme 2 should more properly
be called "User Window Pops." Hence, aaColor refers
to COLOR SCHEME 2 as "User Window Pops" rather than
"User Menus."
Now consider menu systems. Although a menu system has only ten
colorable elements, two color schemes are assigned to control the
colors in a menu system. COLOR SCHEME 3 controls the colors of
the four colorable elements in a menu bar, and COLOR SCHEME 4
controls the colors of the six colorable elements in a menu
- Page 10 -
popup.
The FoxPro documentation explains color sets in terms of color
schemes, and the FoxPro interactive color picker is also oriented
to color schemes. Since color schemes do not correspond to
screen objects in a one-to-one manner, and since the assignment
of color schemes to screen objects is somewhat arbitrary, this
orientation muddles the relationship between screen objects and
the color set system. A simpler and clearer approach is to
orient the discussion of the color set system to screen objects
as done in this document. That is, start with the idea of screen
objects and relate them to their respective color schemes in a
color set. After all, the whole purpose of the color set system
is to control the colors of screen objects.
Therefore, the facilities for viewing and editing color sets in
aaColor are oriented to screen objects rather than color schemes.
This approach clarifies much of the complexity of the color set
system. In aaColor, you first select the screen object whose
colors you want to view or edit. You can then select from among
its colorable elements and pick colors from aaColor's color
picker with instant feedback--that is, aaColor immediately
displays the results in the sample screen object as you make
color selections. aaColor automatically relates screen objects
and their colorable elements to their controlling color schemes
and color pairs in the color set so that you need not be aware of
the complex system of assignments.
CODING EXAMPLES
---------------
Example 1: Using the Alert Color Scheme for a WAIT WINDOW
PROCEDURE AlertWait
PARAMETER AlertMsg
PRIVATE SaveSchm5
m.SaveSchm5 = SCHEME(5) && save Dialog colors
SET COLOR OF SCHEME 5 TO SCHEME 7 && change Dialog colors
&& to Alert colors
??CHR(7) && ring bell
WAIT WINDOW m.AlertMsg + "; press any key to continue..."
SET COLOR OF SCHEME 5 TO (m.SaveSchm5) && restore Dialog colors RETURN
Example 2: Customizing the Color of Help Windows
The FoxPro Developer's Guide explains how you implement context-
sensitive help for applications that you develop. The color of
help windows are controlled by COLOR SCHEMES 8 & 9, the color
schemes that control System Windows. The following illustrates a
technique whereby you can implement help windows in an
application with colors different than System Windows without
- Page 11 -
changing the color of other types of System Windows like the
Calculator, Calendar, etc.
First, use aaColor to set the colors in two of the "user-defined"
color schemes to the desired colors for help windows. The
example below uses COLOR SCHEMES 17 & 18.
At the beginning of the application program, code the following
statements to set up the context-sensitive help:
SET HELP TO <filename>
ON KEY LABEL F1 DO MyHelp && establish help hot key
.
.
.
PROCEDURE MyHelp
PRIVATE SaveSchm8, SaveSchm9
m.SaveSchm8 = SCHEME(8) && save System Window & Popup colors
m.SaveSchm9 = SCHEME(9) &&
SET COLOR OF SCHEME 8 TO SCHEME 17 && change System Window & Popup colors
SET COLOR OF SCHEME 9 TO SCHEME 18 && to Help Window & Popups colors
HELP
SET COLOR OF SCHEME 8 TO (m.SaveSchm8) && restore System Window
SET COLOR OF SCHEME 9 TO (m.SaveSchm9) && & Popup colors
RETURN
- Page 12 -
USING aaCOLOR
=============
INSTALLATION
------------
aaColor is implemented specifically for FoxPro 2.5; it will not
work with prior versions.
aaColor consists of one file as follows:
AACOLOR.APP
For convenient access to aaColor, install aaColor in a
subdirectory included in FoxPro's path.
Once installed, run aaColor by entering
DO AACOLOR
in the FoxPro Command Window.
SELECTION TECHNIQUES
--------------------
aaColor displays dialog boxes in various situations whereby you
select an item from a list after which you press or click a push
button to continue with processing. With such dialogs boxes, a
shortcut for selecting a list item and choosing the default push
button is to double-click on the list item.
This shortcut technique also works in the color-picker and
character-picker dialogs. For example, when using the color-
picker dialog, you can select a color in the palette by clicking
on it and then click on the "<< OK >>" button to close the
dialog. Or using the shortcut method, you can simply double-
click on the color in the palette to select it and close the
dialog.
- Page 13 -
Appendix: MOUSE POINTER COLOR
================================
The mouse pointer in FoxPro is a screen character that has the
same character value as the screen character to which it points
but having a contrasting color. Thus, as you move the mouse
pointer around, its position is apparent because of its
contrasting color. To understand how FoxPro derives the
contrasting color of the mouse pointer, first consider how colors
are specified in FoxPro.
Color monitors display colors by combining the colors red, green,
and blue in various combinations. These three colors can be
combined in eight possible ways to form eight basic colors which
you specify in FoxPro with codes as follows:
Color Code
------- ----
Black N (no color)
Blue B
Green G
Cyan BG (Blue & Green combined)
Red R
Magenta RB (Red & Blue combined)
Brown GR (Green & Red combined)
White W (Blue, Green, & Red combined)
You specify the foreground and background colors for the
characters of a colorable screen element with a color pair, that
is, a pair of color codes separated by a slash (/). For example,
W/B specifies a white foreground on a blue background.
The FoxPro color codes are based on IBM PC CGA/EGA/VGA text mode
video in which each display character has an attribute byte,
various bits of which specify its foreground and background
colors. Without getting into a detailed discussion of the
CGA/EGA/VGA video attribute byte, it suffices to say that three
bits--corresponding to red, green, and blue--specify the
foregorund color, and another three bits specify the background
color as follows.
- Page 14 -
Color Bits
------------- decimal
R G B value Color Code
--- --- --- ------- ------- ----
0 0 0 0 Black N
0 0 1 1 Blue B
0 1 0 2 Green G
0 1 1 3 Cyan BG
1 0 0 4 Red R
1 0 1 5 Magenta RB
1 1 0 6 Brown GR
1 1 1 7 White W
The "inverse" of a color is the color derived by inverting the
value of each of the "RGB" color bits. For example, the "RGB"
bits for Blue (color code B) are "001"; inverting these bits
yeilds "110", the code for Brown (color code GR). Hence, the
inverse of blue is brown. The following table shows the inverse
of each color similarly derived.
Normal Inversed
------------- -------------
Color Code Color Code
------- ---- ------- ----
Black N White W
Blue B Brown GR
Green G Magenta RB
Cyan BG Red R
Red R Cyan BG
Magenta RB Green G
Brown GR Blue B
White W Black N
FoxPro derives the contrasting color pair for a character to
which the mouse points by inverting both its foreground color and
background color. For example, if the color of a character is
W/B (White/Blue), then its color will be N/GR (Black/Brown) when
the mouse points to it.
- Page 15 -